<script type="text/javascript">
	jQuery(document).ready(function(){
		$("a[rel^='prettyPhoto']").prettyPhoto();
	});
	
	jQuery(document).ready(function(){
			
		$("#header_menu ul").superfish({ 
			delay:       500,
			animation:   {opacity:'show' ,height:'show'},
			speed:       'fast',
			autoArrows:  false,
			dropShadows: false
		});
		


		/* FPM Features hover */
		$('.front_page_element .featured_item').hover(
			function()
			{
				$(this).addClass('active');
				$('.front_page_element .featured_item.active .featured_icon').stop().animate({paddingTop: "35px"}, 200);
				$('.front_page_element .featured_item').not('.active').stop().animate({opacity:0.5},300);

			},
			function()
			{
				$('.front_page_element .featured_item.active .featured_icon').stop().animate({paddingTop: "50px"}, 300);
				jQuery(this).removeClass('active');
				$('.front_page_element .featured_item').stop().animate({opacity:1},600);
			}
		);
		
		
		
		/* FPM CONTACT FORM ICONS FOCUS */
		$('.front_page_element #contact_form #fpm_contact_name input').focus(
			function()
			{
				$('.front_page_element #contact_form .icon_name_hover').stop().animate({opacity:0.9},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_name input').focusout(
			function()
			{
				$('.front_page_element #contact_form .icon_name_hover').stop().animate({opacity:0},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_email input').focus(
			function()
			{
				$('.front_page_element #contact_form .icon_email_hover').stop().animate({opacity:0.9},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_email input').focusout(
			function()
			{
				$('.front_page_element #contact_form .icon_email_hover').stop().animate({opacity:0},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_company input').focus(
			function()
			{
				$('.front_page_element #contact_form .icon_company_hover').stop().animate({opacity:0.9},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_company input').focusout(
			function()
			{
				$('.front_page_element #contact_form .icon_company_hover').stop().animate({opacity:0},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_phone input').focus(
			function()
			{
				$('.front_page_element #contact_form .icon_phone_hover').stop().animate({opacity:0.9},400);
			}
		);
		
		$('.front_page_element #contact_form #fpm_contact_phone input').focusout(
			function()
			{
				$('.front_page_element #contact_form .icon_phone_hover').stop().animate({opacity:0},400);
			}
		);
		
		
																			 
		/* FPM IMAGE HOVER */
		$('.front_page_picture img').hover(
			function(){jQuery(this).stop().animate({opacity:0.65},400); },
			function(){jQuery(this).stop().animate({opacity:1},400);
		});
		
		$('.nivo-control').hover(   // big thumbnails for nivo slider
			function()
			{ 
				if ( !jQuery(this).hasClass('active') )
              		{
						jQuery(this).stop().fadeTo(100,0.9);
					}
			},
			function()
			{
            	jQuery(this).stop().fadeTo(100,0.5);
			}
		);
		
		$('.blog_image, .portfolio_image').hover(
			function()
			{
				jQuery(this).children('.on_top').stop().animate({opacity:0},200);
				jQuery(this).children('.zoom').stop().animate({opacity:1},200);
			},
			function()
			{
				jQuery(this).children('.on_top').stop().animate({opacity:1},500);
				jQuery(this).children('.zoom').stop().animate({opacity:0},200);
			}
		);
		
		$('.gallery_item a, .gallery_item_last a').hover(
			function()
			{
				jQuery(this).children('img').stop().animate({opacity:0.5},200);
				jQuery(this).children('.gallery_zoom').stop().animate({opacity:1},200);
			},
			function()
			{
				jQuery(this).children('img').stop().animate({opacity:1},500);
				jQuery(this).children('.gallery_zoom').stop().animate({opacity:0},200);
			}
		);
		
		
		$('#portfolio_masonry .item a').hover(
			function()
			{
				jQuery(this).children('.on_top').stop().animate({opacity:0},200);
				jQuery(this).children('.content_wrapper').stop().animate({opacity:1},200);
			},
			function()
			{
				jQuery(this).children('.on_top').stop().animate({opacity:1},500);
				jQuery(this).children('.content_wrapper').stop().animate({opacity:0},200);
			}
		);
		
		$("#complex_slider .complex_element a").each(function() {
		    $(this).find(".content_wrapper").css("opacity", 0);
	    });
		
		$('#complex_slider .complex_element a').hover(
			function()
			{
				jQuery(this).children('.content_wrapper').stop().animate({opacity:1},200);
			},
			function()
			{
				jQuery(this).children('.content_wrapper').stop().animate({opacity:0},200);
			}
		);
		
		// MASONRY
		$('#portfolio_masonry').isotope({
			 layoutMode : 'masonry'
		});
		
		
		$('.big_carousel_no_border li').hover(   // carousel slider
			function()
			{ 
				jQuery(this).stop().fadeTo(100,1);

			},
			function()
			{
            	jQuery(this).stop().fadeTo(100,0.75);
			}
		);
		
		$('.element').hover(   // carousel slider
			function()
			{ 
				jQuery(this).stop().fadeTo(100,1);

			},
			function()
			{
            	jQuery(this).stop().fadeTo(100,0.75);
			}
		);
		
		
		$('table tbody tr:even').addClass("alternate");
		
		$('.social_icon_25 .hover').hover(   
			function()
			{ 
				$(this).stop().fadeTo(250,1);

			},
			function()
			{
            	$(this).stop().fadeTo(100,0);
			}
		);
		
		$('.social_icon_30 .hover').hover(   
			function()
			{ 
				$(this).stop().fadeTo(250,1);

			},
			function()
			{
            	$(this).stop().fadeTo(100,0);
			}
		);
		
		// to_top START

		$("#backtotop").hide().removeAttr("href");
		
		if ($(window).scrollTop() != "0")
			$("#to_top").fadeIn("slow")

		var scrollDiv = $("#to_top");
		
		$(window).scroll(function()
		{
			if ($(window).scrollTop() == "0")
				$(scrollDiv).fadeOut("slow")

			else
				$(scrollDiv).fadeIn("slow")
		});
		
		$("#to_top").click(function()
		{
			$("html, body").animate({
				scrollTop: 0
			}, "slow")
		})
		
		// to_top END 
		
		
		// TABS
		$(".tabs").tabs();
		
		// TOUR:
		
		// TOUR - CONTENT WITHOUT SIDEBAR STYLING
		var tour_li_count = $("#content_wrapper .tour ul").children('.tour_li').length - 1;
		var tour_width = 941 / tour_li_count;
		$('#content_wrapper .tour li.tour_li:last-child .line', this).remove();

		$('#content_wrapper .tour li.tour_li').css("width", tour_width);
		$('#content_wrapper .tour li.tour_li:last-child').css("width", "19px");
		$('#content_wrapper .tour li.tour_li .line').css("width", tour_width-19);
		
		// TOUR - CONTENT WITH SIDEBAR STYLING
		var tour_li_count = 0;
		tour_li_count = $("#content_wrapper #content_with_sidebar .tour > ul").children('.tour_li').length - 1;
		var tour_width = 611 / tour_li_count;
		$('#content_wrapper #content_with_sidebar .tour li.tour_li:last-child .line', this).remove();

		$('#content_wrapper #content_with_sidebar .tour li.tour_li').css("width", tour_width);
		$('#content_wrapper #content_with_sidebar .tour li.tour_li:last-child').css("width", "19px");
		$('#content_wrapper #content_with_sidebar .tour li.tour_li .line').css("width", tour_width-19);


		// START TOUR
		$('.tour').tabs();
		$('.tour li.tour_li a').click(function() {
			$('.tour li.tour_li').removeClass('ui-tabs-before-active');									 
			$('.tour .ui-state-active').prevAll('li.tour_li').addClass('ui-tabs-before-active');
		});
		
		// TOGGLES
		$(document).ready(function() {
			$(".toggle_header").click(function() {
				$(this).next(".toggle_content").stop(true, true).toggle("fast");
					
				if (jQuery(this).hasClass("toggle_active"))
				{
					$(this).removeClass("toggle_active");
				}
				
				else
				{
					$(this).addClass("toggle_active");
				}
			});
		});
		
		// AUTHOR TOGGLES
		$(document).ready(function() {
			$("#author_toggle_header").click(function() {
				$("#author_toggle_content").stop(true, true).toggle("fast");
					
				if (jQuery("#author_toggle_header").hasClass("toggle_active"))
				{
					$("#author_toggle_header").removeClass("toggle_active");
				}
				
				else
				{
					$("#author_toggle_header").addClass("toggle_active");
				}
			});
		});
			
	});

<?php		
	$nivo_class = '#slider_content';
	
	if ( get_option('nivo_effects') == '' ) $nivo_effects = 'random';
	else $nivo_effects = get_option('nivo_effects');
	
	if ( get_option('nivo_slices') == '' ) $nivo_slices = '15';
	else $nivo_slices = get_option('nivo_slices');
	
	if ( get_option('nivo_pause_on_hover') == '' ) $nivo_pause_on_hover = 'true';
	else $nivo_pause_on_hover = get_option('nivo_pause_on_hover');
	
	if ( get_option('nivo_pause_time') == '' ) $nivo_pause_time = '5000';
	else $nivo_pause_time = get_option('nivo_pause_time');
	$nivo_pause_time = str_replace('ms', '', $nivo_pause_time);
	
	if ( get_option('nivo_animation_speed') == '' ) $nivo_animation_speed = '500';
	else $nivo_animation_speed = get_option('nivo_animation_speed');
	$nivo_animation_speed = str_replace('ms', '', $nivo_animation_speed);
	
	if ( get_option('nivo_thumbnails') == 'on' ) $nivo_control_args = 'directionNav: false, controlNav:false, controlNavCarousel:true, manualAdvance: true';
	else $nivo_control_args = 'controlNav:true, controlNavCarousel:false';
				   
	if ( get_option('slider_active') == 'yes' && get_option('slider_selection') == 'nivo_slider' )		
	echo '/// START NIVO
	//jQuery.noConflict();
	$(window).load(function() {
		$(\''.$nivo_class.'\').nivoSlider({
			captionOpacity: 1,
			effect: \''.$nivo_effects.'\',
			boxRows: 5,
			slices: \''.$nivo_slices.'\',
			pauseOnHover: \''.$nivo_pause_on_hover.'\',
			pauseTime: \''.$nivo_pause_time.'\',
			animSpeed: \''.$nivo_animation_speed.'\',
			'.$nivo_control_args.'
		});
	});';

 	if ( get_option('slider_active') == 'yes' && ( get_option('slider_selection') == 'anything_slider' || get_option('slider_selection') == 'anything_video' ) )
	{
		echo '//// START  ANYTHING SLIDER
		  function formatText(index, panel) {
			  return index + "";
		  };
	
		jQuery(document).ready(function($) {
		   
		   $(\'.anything_slider_ul\').anythingSlider({
				easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
				autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
				pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
				resumeOnVideoEnd    : true,      // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete
				addWmodeToObject    : "opaque",  // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
				expand              : false,';
				
				if ( get_option('anything_slider_pause_time') == '' ) $anything_slider_pause_time = '5000';
				else $anything_slider_pause_time = get_option('anything_slider_pause_time');
				
				if ( get_option('anything_slider_animation_speed') == '' ) $anything_slider_animation_speed = '600';
				else $anything_slider_animation_speed = get_option('anything_slider_animation_speed');
				
				if ( get_option('slider_selection') == 'anything_video' )
				{
					if ( get_option('anything_slider_pause_time') == '' ) $anything_slider_pause_time = '5000';
					else $anything_slider_pause_time = get_option('anything_slider_pause_time');
					
					if ( get_option('anything_slider_animation_speed') == '' ) $anything_slider_animation_speed = '600';
					else $anything_slider_animation_speed = get_option('anything_slider_animation_speed');
				}
				
				$anything_slider_pause_time = str_replace('ms', '', $anything_slider_pause_time);
				$anything_slider_animation_speed = str_replace('ms', '', $anything_slider_animation_speed);

				
				echo '
				delay               : '.$anything_slider_pause_time.',      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
				animationTime       : '.$anything_slider_animation_speed.'
			});
				
		});';
	}

	if (get_option('slider_active') == 'yes' && get_option('slider_selection') == 'bx_slider')	
	echo '
	jQuery(document).ready(function() {
		var bx_content_slider = $(\'.bx_slider\').bxSlider({
        	mode: "fade",
			controls: false
    	});

		$(\'.bx-prev, .bx-prev-boxed\').click(function(){
			bx_content_slider.goToPreviousSlide();
			return false;
		});
		
		$(\'.bx-next, .bx-next-boxed\').click(function(){
			bx_content_slider.goToNextSlide();
			return false;
		});
	});';

	?>
	///// START CONTENT SCROLLER
	
	jQuery(document).ready(function() {
    	var content_scroller = $('#mycarousel').bxSlider({
        	displaySlideQty: 6,
			moveSlideQty: <?php echo get_option('content_scroller_elements_to_scroll', '2'); ?>,
			speed: 300,
			controls: false
    	});
		
		$("#content_scroller_prev").click(function(){
			content_scroller.goToPreviousSlide();
			$("a[rel^='prettyPhoto']").prettyPhoto();
			return false;
		});
		
		$("#content_scroller_next").click(function(){
			content_scroller.goToNextSlide();
			$("a[rel^='prettyPhoto']").prettyPhoto();
			return false;
		});
		
	});
	
	///// END CONTENT SCROLLER
	


	
	jQuery(document).ready(function() {
		var browser_viewport_width = jQuery(window).width();
		var item_width = parseInt(<?php
								  	$carousel_width = get_option('carousel_width');
								  
								  	if ( get_option('carousel_size') != 'custom' )
									{
										if ( get_option('carousel_size') == 'tall' ) $carousel_width = '250';
										if ( get_option('carousel_size') == 'square' ) $carousel_width = '350';
										if ( get_option('carousel_size') == 'wide' ) $carousel_width = '500';
									}
									
									if ( $carousel_width == '' )
										$carousel_width = '350';
										
									echo $carousel_width;
								  ?>)
		<?php 
			if ( get_option('carousel_border') == 'on' ) echo 'item_width += 10;';
		?>
  
     	var nr_of_slides = parseInt(browser_viewport_width / item_width) + 1;
		var nr_of_elements_to_scroll = <?php if ( get_option('carousel_scroll_number') == '' ) echo '2'; else echo get_option('carousel_scroll_number'); echo ';'; ?>
    	var carousel_slider = $('#big_carousel').bxSlider({
        	displaySlideQty: nr_of_slides,
			moveSlideQty: nr_of_elements_to_scroll,
			speed: 300,
			controls: false
			
    	});

		$('#big_carousel_prev').click(function(){
			carousel_slider.goToPreviousSlide();
			return false;
		});
		
		$('#big_carousel_next').click(function(){
			carousel_slider.goToNextSlide();
			return false;
		});
	});
	


	///// START JQUERY CAROUSEL
	jQuery(document).ready(function($) {
		$('#thumbnail_carousel ul').jcarousel({
	    	wrap: 'circular'
 	   });	
	});
	
	///// START JQUERY CAROUSEL
	jQuery(document).ready(function($) {
		$('#complex_slider').jcarousel({
			scroll: 3,
			wrap: 'circular' 
 	   });	
	});
	
	<?php 
	
	if (get_option('slider_active') == 'yes' && get_option('slider_selection') == 'accordion_slider')	
	echo '
	jQuery(document).ready(function($) {
		$(\'.kwicks\').kwicks({
			max : 640,
			spacing : 0
		});
		
		$("#accordion_slider ul li").each(function() {
		    $(this).find(".accordion_caption").css("opacity", 0);
	    });

		$("#accordion_slider ul li").hover(function(){
					$(this).find(".accordion_caption").stop().animate({opacity:0.9},500);},
					function(){$(this).find(".accordion_caption").stop().animate({opacity:0},500);
		});
	});';
		
	
	if ( get_option('slider_active') == 'yes' && get_option('slider_selection') == 'piecemaker' )
	{
		echo 'var flashvars = {};'."\n";
		echo 'flashvars.cssSource = "'; echo get_template_directory_uri(); echo '/js/piecemaker/piecemaker.css";'."\n";  
			  echo 'flashvars.xmlSource = "'; echo get_template_directory_uri(); echo '/js/piecemaker/piecemakerXML.php";'."\n"; 
			  echo 'flashvars.imageSource = "'; echo get_template_directory_uri(); echo '/js/piecemaker/";'."\n";  
	
			  echo' var params = {};
			  params.play = "true";
			  params.menu = "false";
			  params.scale = "showall";
			  params.wmode = "transparent";
			  params.allowfullscreen = "true";
			  params.allowscriptaccess = "always";
			  params.allownetworking = "all";'."\n";
			  echo 'params.base = "'; echo get_template_directory_uri(); echo '/js/piecemaker/";';
	
		echo 'swfobject.embedSWF("'; echo get_template_directory_uri(); echo '/js/piecemaker/piecemaker.swf", "piecemaker", "100%", "500", "10","'; echo get_template_directory_uri(); echo '/js/piecemaker/scripts/swfobject/expressInstall.swf';  echo '" , flashvars, params, null);';
	}
	
	?>

	
	
	
</script>

<?php
	$google_analytics =  get_option('google_analytics');
	if ( $google_analytics != '' )
		echo $google_analytics;
?>